JavaScript
$u.s.tran Function
Syntax
$u.s.tran(str as string, search as string/array of strings, replace as string/array of strings)
Arguments
- strstring
The string to transform
- searchstring, array
A string or array of strings that specifies the substrings to replace.
- replacestring, array
A string or array of strings that specifies the replacement strings.
Description
Replace single or multiple strings in a string.
Example
var str = 'The boy wore a yellow shirt'; str = $u.s.tran(str,'boy','girl'); /* result is: 'The girl wore a yellow shirt'*/ str = $u.s.tran(str,['boy','yellow'],['girl','green']); /*result is 'The girl wore a green shirt'*/